{% extends 'myadmin/base.html' %}
{% block main_body %}
<style>
    .form-card {
        background: #fff;
        border-radius: 6px;
        box-shadow: 0 1px 3px rgba(0,0,0,0.1);
        padding: 20px;
    }
    .form-section {
        margin-bottom: 20px;
        padding-bottom: 15px;
        border-bottom: 1px solid #f1f1f1;
    }
    .form-row {
        display: flex;
        flex-wrap: wrap;
        margin: 0 -10px;
    }
    .form-col {
        flex: 1;
        min-width: 300px;
        padding: 0 10px;
        box-sizing: border-box;
    }
    .form-group {
        margin-bottom: 12px;
        width: 100%;
    }
    .form-group label {
        font-weight: 600;
        font-size: 13px;
        margin-bottom: 5px;
        display: block;
    }
    .form-control {
        width: 100%;
        padding: 6px 10px;
        font-size: 13px;
        height: 34px;
        box-sizing: border-box;
    }
    textarea.form-control {
        height: auto;
        min-height: 100px;
    }
    .checkbox-group {
        display: flex;
        align-items: center;
        gap: 10px;
        margin-top: 8px;
    }
    .btn-group {
        margin-top: 15px;
        display: flex;
        gap: 10px;
        justify-content: flex-end;
    }
    .required-mark {
        color: #dd4b39;
        margin-left: 3px;
    }
</style>

<section class="content-header">
    <h1>用户反馈管理 <small>添加反馈</small></h1>
    <ol class="breadcrumb">
        <li><a href="#"><i class="fa fa-home"></i> 首页</a></li>
        <li><a href="#">用户管理</a></li>
        <li class="active">添加反馈</li>
    </ol>
</section>

<section class="content">
    <div class="row">
        <div class="col-md-12">
            <div class="box box-primary">
                <div class="box-header with-border">
                    <h3 class="box-title">反馈信息录入</h3>
                </div>
                <form method="post" action="{% url 'myadmin_userfeedback_add' %}" class="form-card">
                    {% csrf_token %}
                    
                    <!-- 基础信息 -->
                    <div class="form-section">
                        <h4><i class="fa fa-comment"></i> 反馈基本信息</h4>
                        <div class="form-row">
                            <div class="form-col">
                                <div class="form-group">
                                    <label>所属用户 <span class="required-mark">*</span></label>
                                    <select name="user_id" class="form-control" required>
                                        {% for user in users %}
                                        <option value="{{ user.id }}">{{ user.username }} ({{ user.name }})</option>
                                        {% endfor %}
                                    </select>
                                </div>
                                <div class="form-group">
                                    <label>反馈类型 <span class="required-mark">*</span></label>
                                    <select name="feedback_type" class="form-control" required>
                                        {% for type in feedback_types %}
                                        <option value="{{ type.0 }}">{{ type.1 }}</option>
                                        {% endfor %}
                                    </select>
                                </div>
                                <div class="form-group">
                                    <label>关联食谱</label>
                                    <select name="related_recipe_id" class="form-control">
                                        <option value="">-- 无关联食谱 --</option>
                                        {% for recipe in recipes %}
                                        <option value="{{ recipe.id }}">{{ recipe.name }}</option>
                                        {% endfor %}
                                    </select>
                                </div>
                            </div>
                            <div class="form-col">
                                <div class="form-group">
                                    <label>反馈内容 <span class="required-mark">*</span></label>
                                    <textarea name="content" class="form-control" required></textarea>
                                </div>
                            </div>
                        </div>
                    </div>
                    
                    <!-- 处理信息 -->
                    <div class="form-section">
                        <h4><i class="fa fa-cog"></i> 处理信息</h4>
                        <div class="form-row">
                            <div class="form-col">
                                <div class="form-group">
                                    <label>解决状态</label>
                                    <div class="checkbox-group">
                                        <input type="checkbox" name="is_resolved" id="is_resolved">
                                        <label for="is_resolved">标记为已解决</label>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label>回复内容</label>
                                    <textarea name="reply" class="form-control"></textarea>
                                </div>
                            </div>
                        </div>
                    </div>
                    
                    <!-- 操作按钮 -->
                    <div class="btn-group">
                        <button type="button" class="btn btn-default" onclick="window.history.back();">返回</button>
                        <button type="reset" class="btn btn-default">重置</button>
                        <button type="submit" class="btn btn-primary">保存</button>
                    </div>
                </form>
            </div>
        </div>
    </div>
</section>
{% endblock %}